
<?php
  require_once('inc_admin.php');
  //连接数据库 
  connect();
  $id = $_POST['id'];
  if(!empty($_FILES["pic"]["name"])){
    $pic = uploadfile('pic',UserPhotoPath,array('png','jpg','gif'));
  }
  else{
    $pic='';
  }
$data = array(
    'videoname' => trim($_POST['videoname']),
    'tid' => $_POST['tid'],
    'pic' => $pic,
    'intro'=> $_POST['intro'],
    'address' => $_POST['address']);
  
  $result = update('videos',$data,'vid='.$id);
  if(!$result){
    echo "更新失败！</br>";
    echo "<a href='videoedit-form.php?id=($id)'>返回</a>";   
  }else{    
    redirect('video-list.php', '更新成功！');
  }    
   /* $sql = "update users set uname='{$uname}', birthdate='{$birthdate}', gender={$gender}, hobby='{$hobby}', degree={$degree},intro='{$intro}', pic='{$newname}' where uid={$id}";  

  $result = mysql_query($sql) or die("sql={$sql}, 更新失败！<br/>".mysql_error());*/

  //判断是否更新成功

 ?>
